<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
    .current{
        color:orange;
        background: #abcdef;
    }
    .fs{
        font-size: 30px;
    }
    </style>
</head>
<body>
    <p id="test" class="current bg">hello world</p>
    <script>
        var test = document.getElementById("test");
        test.onclick = function(){
            // 1.ele.style.backgroundColor = "#0ea432";
            // 2.ele.className = "current";
            // 3.ele.style.cssText = "color:#abcdef;font-size:30px;"
            // 4.ele.classList.add("fs");//classlist获取的是一个class集合
            // this.classList.remove("current");
            // this.classList.toggle("current");
            console.log(this.classList.contains("current"));//查看是否包含某个class，结果返回boolean
            // 5.ele.setAttribute("attr",value);
            test.setAttribute("style","color:red");
            // test.setAttribute("class","current");
        }
    </script>
</body>
</html>